package com.campus.mapper;

import com.campus.domain.entity.ReplyLike;
import org.apache.ibatis.annotations.*;

/**
 * 回复点赞Mapper
 */
@Mapper
public interface ReplyLikeMapper {
    
    // 插入点赞
    @Insert("INSERT INTO reply_likes(reply_id, user_id) VALUES(#{replyId}, #{userId})")
    int insert(ReplyLike like);
    
    // 删除点赞
    @Delete("DELETE FROM reply_likes WHERE reply_id = #{replyId} AND user_id = #{userId}")
    int delete(@Param("replyId") Long replyId, @Param("userId") Long userId);
    
    // 查询是否已点赞
    @Select("SELECT COUNT(*) FROM reply_likes WHERE reply_id = #{replyId} AND user_id = #{userId}")
    int exists(@Param("replyId") Long replyId, @Param("userId") Long userId);
}

